//
//  ViewController.m
//  GCDDemo
//
//  Created by UniHan_iMac on 17/3/29.
//  Copyright © 2017年 UniHan_iMac. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

// 创建主线程
- (void)mainQueue
{
    dispatch_queue_t mainQueue = dispatch_get_main_queue();
    dispatch_async(mainQueue, ^{
        
    });
    
    dispatch_async(dispatch_get_main_queue(), ^{
        
    });
}
// 创建分线程：并行队列
- (void)globalQueue
{
    dispatch_queue_t globalQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
    dispatch_async(globalQueue, ^{
        
    });
    
    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
        
    });
}
// 创建分线程：串行队列
- (void)serialQueue
{
    // NULL 设置为串行队列
    dispatch_queue_t serialQueue = dispatch_queue_create("", NULL);
    dispatch_async(serialQueue, ^{
        
    });
    // DISPATCH_QUEUE_SERIAL 设置为串行队列
    dispatch_async(dispatch_queue_create("队列标识符", DISPATCH_QUEUE_SERIAL), ^{
        
    });
    // DISPATCH_QUEUE_CONCURRENT 设置为并行队列
   dispatch_async(dispatch_queue_create("队列标识符", DISPATCH_QUEUE_CONCURRENT), ^{
       
   });
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
}
@end
